package com.push.notnoop.biyao.com;

import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.notnoop.apns.APNS;

public class IOSPushJob {
    private static final Logger logger = LoggerFactory.getLogger(IOSPushJob.class);
	private static Queue<String> cqueue = new ConcurrentLinkedQueue<String>();
	
	public static void main(String[] args) {
		int batchHourDataRunHours = 3600;
		String payload = APNS.newPayload().badge(10).alertBody("2015-11-17 guochong,nihao!").build();
		offer();
		IOSPushRunnable iOSPushRunnable = new IOSPushRunnable(payload, cqueue);
		ScheduledExecutorService service = Executors.newScheduledThreadPool(3);
		service.scheduleAtFixedRate(iOSPushRunnable, 1, batchHourDataRunHours, TimeUnit.SECONDS);
	}
	
    /**
     * 生产
     */
    public static void offer() {
		String token1 = "7b4561a3d2fd1fe7c12b923525b0ec64a59b4b81efc4e9841213ef1a2dc4876e";
		String token2 = "7b4561a3d2fd1fe7c12b923525b0ec64a59b4b81efc4e9841213ef1a2dc4876e";
		cqueue.offer(token1);
		cqueue.offer(token2);
		logger.info(token1);
    }
}
